#include "teacher.h"
using namespace std;

void teacher::add_stu(student* stu)
{
	observers.push_back(stu);
}

void teacher::delete_stu(student* stu)
{
	observers.remove(stu);
}

void teacher::notify_stu()
{
	list<student*>::iterator it_stu;
	for (it_stu = observers.begin(); it_stu != observers.end(); it_stu++)
	{
		(*it_stu)->update_content();
	}
}

void Math_Teacher::set_content(string stu_homework)
{
	manage_homework = name + "'s " + stu_homework;
	cout << name + " Release " + stu_homework<<endl;
	notify_stu();
}

string Math_Teacher::get_content()
{
	return manage_homework;
}

string Math_Teacher::get_name()
{
	return name;
}

void En_Teacher::set_content(string stu_homework)
{
	manage_homework= name + "'s " + stu_homework;
	cout << name + " Release " + stu_homework << endl;
	notify_stu();
}

string En_Teacher::get_content()
{
	return manage_homework;
}

string En_Teacher::get_name()
{
	return name;
}